package com.thoughtworks.impersonator.http.test;

import com.thoughtworks.impersonator.http.message.Message;
import com.thoughtworks.impersonator.http.message.RawRequest;
import com.thoughtworks.impersonator.http.message.RawResponse;
import com.thoughtworks.impersonator.http.message.transform.RequestTransformer;
import com.thoughtworks.impersonator.http.message.transform.ResponseTransformer;

public class AllCapsTransformer implements RequestTransformer, ResponseTransformer {

    @Override
    public void transform(RawRequest request) {
        upperCaseBody(request);
    }

    @Override
    public void transform(RawResponse response) {
        upperCaseBody(response);
    }

    private void upperCaseBody(Message message) {
        message.setBody(message.getBody().toUpperCase());
    }
}
